OLE DB Driver

OLE DB (Object Linking and Embedding, Database) is an API designed by Microsoft for accessing data from a variety of sources in a uniform manner so it can be used by all Microsoft platforms. It is a set of interfaces implemented using the Component Object Model (COM).

.NET Framework is a software framework for Microsoft Windows operating systems. It includes a large library and it supports several programming languages which allows language interoperability (each language can utilize code written in other languages). The .NET library is available to all programming languages that .NET supports. A data provider in the .NET Framework serves as a bridge between an application and a data source; a data provider is used to retrieve data from a data source and to reconcile changes to that data back to the data source.

CUBRID OLE DB driver is written based on CCI API so affected by CCI configurations such as CCI_DEFAULT_AUTOCOMMIT.

To download OLD DB driver or get the latest information, click http://www.cubrid.org/wiki_apis/entry/cubrid-oledb-driver .

Installing and Configuring OLE DB

Requirements

CUBRID OLE DB Provider

Before you start developing applications with CUBRID, you will need the Provider driver (CUBRIDProvider.dll). Make sure to download the appropriate DLL according to your CUBRID installation. You can check the CUBRID version by entering the command, cubrid -- version. You have four options to get the driver.

If you do not use the CUBRID OLED DB Provider installer, you should execute the command below to register the driver. The version of the driver should match the version of your operating system. For 32 bit, the regsvr32 command should be executed in the C:Windowssystem32 directory; for 64 bit, the regsvr32 command should be executed in the C:WindowsSysWOW64 directory.

regsvr32 CUBRIDProvider.dll

OLE DB Programming

Configuring Connection String

When you do programming on the CUBRID OLE DB Provider using ActiveX Data Objects (ADO) or ADO.NET, you should write connection string as follows:

Item Example Description
Provider CUBRIDProvider Provider name
Data Source demodb Database name
Location 127.0.0.1 The IP address or host name of the CUBRID broker server
User ID PUBLIC User ID
Password xxx Password
Port 33000 The broker port number
Fetch Size 100 Fetch size

A connection string using the example above is as follows:

"Provider=CUBRIDProvider;Data Source=demodb;Location=127.0.0.1;User ID=PUBLIC;Password=xxx;Port= 33000;Fetch Size=100"

Note

  • Because a semi-colon (;) is used as a separator in URL string, it is not allowed to use a semi-colon as parts of a password (PWD) when specifying the password in connection string.
  • If a string longer than defined max length is inserted (INSERT) or updated (UPDATE), the string will be truncated.
  • The database connection in thread-based programming must be used independently each other.
  • In autocommit mode, the transaction is not committed if all results are not fetched after running the SELECT statement. Therefore, although in autocommit mode, you should end the transaction by executing COMMIT or ROLLBACK if some error occurs during fetching for the resultset.

Multi-Threaded Programming in .NET Environment

Additional considerations when you do programming with the CUBRID OLE DB Provider in the Microsoft .NET environment are as follows:

If you do multi-threaded programming using ADO.NET in the management environment, you need to change the value of the ApartmentState attribute of the Thread object to a ApartmentState.STA value because the CUBRID OLE DB Provider supports the Single Threaded Apartment (STA) attribute only.

Without any changes of given values, the default value of the attribute in the Thread object returns Unknown value, causing it to malfunction during multi-threaded programming.

Warning

All OLE DB objects are the Component Object Model. Of COM threading model, the CUBRID OLE DB Provider currently supports the apartment threading model only, which is available in every multi-threaded environment as well as .NET environment.

OLE DB API

For more information about OLE DB API, see Micorosoft OLE DB documentation at http://msdn.microsoft.com/en-us/library/ms722784%28vs.85%29.aspx .